<template>
    <div class="top">
        <div class="left">
            <img src="../../assets/logo.0a3252a6.png" alt="">
            <div class="title">助农扶贫系统</div>
        </div>
        <div class="center">
            <!-- <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/sys_home' }">系统首页</el-breadcrumb-item>
                <el-breadcrumb-item>活动管理</el-breadcrumb-item>
            </el-breadcrumb> -->
        </div>
        <div class="right">
            <img :src="userInfo.avatarUrl" alt="">
            <el-dropdown @command="handleCommand">
                <span class="el-dropdown-link">
                    {{ userInfo.username }}<i class="el-icon-arrow-down el-icon--right"></i>
                </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item command="loginout">退出登录</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
    </div>
</template>
<script>
import { mapMutations, mapState } from 'vuex';
export default {
    name: 'Top',
    components: {

    },
    mixins: [],
    props: {

    },
    data() {
        return {

        }
    },
    computed: {
        ...mapState('userStore', ['userInfo'])
    },
    watch: {

    },
    mounted() {

    },
    methods: {
        ...mapMutations('userStore', ['loginout']),
        handleCommand(command) {
            if (command == 'loginout') {
                this.loginout()
            }
        }
    }
};
</script>
<style lang='less' scoped>
.top {
    position: fixed;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    background-color: #07c796;
    padding: 0 30px;
    z-index: 99;

    .left {
        width: 200px;
        display: flex;
        align-items: center;

        img {
            width: 40px;
            height: 40px;
            border-radius: 2px;
        }

        .title {
            color: white;
            font-size: 25px;
            font-weight: 700;
            margin-left: 10px;
        }
    }

    .center {
        flex: 1;
        padding-left: 50px;
        color: white;
    }

    .right {
        display: flex;
        align-items: center;

        img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 10px;
        }

        .el-dropdown-link {
            cursor: pointer;
            color: white;
        }

        .el-icon-arrow-down {
            font-size: 12px;
        }


    }
}
</style>